<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/common/includes.jsp" %>
<html>
 <head>
    <title>销售订单驳回</title>
    <!-- import css and js -->
	<%@ include file="/common/meta.jsp" %>
	<script src="${ctx}/js/ligerUI/js/plugins/ligerLayout.js" type="text/javascript"></script>
	<script src="${ctx}/js/jsp/comm.js" type="text/javascript"></script>
	<script type="text/javascript" src="${ctx}/js/jsp/xxkj/logic/backsales.js"></script>
	<script type="text/javascript">
	var type ="${type}";
	var basic_Url="${ctx}/logic/sales";
	var basic_WUrl="logic/sales";
	var basic_Title="销售订单";
	var show_Width=880;
	var show_Hight=500;
	function createSearch(){
		init(1,8,'100,100,100,100,100,100,100,100','10%');
		//第一行的数据
		addCommon(0,0,"lable","销售单号：");
		addCommon(0,1,"txtlike","g.zd001FormCode");
		addCommon(0,2,"lable","客户单位名称：");
		addCommon(0,3,"txtlike","g.zd006CustomerName");
		addCommon(0,4,"lable","制单人：");
		addCommon(0,5,"txtlike","g.bizCreatorName");
		addCommon(0,6,"lable","PI编号：");
		addCommon(0,7,"txtlike","g.zd002PiCode");
	}
		
	function searchAP(){
		multipleSearch("#table1",true,"",basic_Url+"/backList.do");
	}
	document.onkeydown=keyListener;   
	function keyListener(e){   
	    e = e ? e : event;  
	    if(e.keyCode == 13){   
	    	searchAP();
	    }   
	}  
	//驳回
	function backSale(){
		var manager = $("#table1").ligerGetGridManager(); 
		var cRows = manager.getSelectedRows();
		if (cRows==null || 0==cRows.length){
			$.dialog.alert('请选择需要驳回的数据行！');
			return;
		}else{
			var backIdStr = "";
			var zdStepStr = "";
			for(var i=0; i<cRows.length; i++) {
			 	if(i!=0){
			 		backIdStr+=",";
			 		zdStepStr+=",";
			 	}
			 	//获得行数据
			 	backIdStr += cRows[i].id;
			 	zdStepStr += cRows[i].zdStep;
			}
			getDG().dialog({content: "请确定选择驳回数据(Yes或者No)!",width: 250,lock: true,max: false,min: false,
				title:'Confirm Infor',
				button: [{
					name: 'Yes',
		            callback: function(){
			        	$.ajax({
			           		url: sys_context+"/logic/sales/backSale.do",
			           	    global: false,
			           	    type: "POST",
			           	    dataType: "json",
			           	    data: ({backIdStr : backIdStr, zdStepStr : zdStepStr}),		     
			           	    success: function(msg){	
			           	    	manager.removeRange(cRows);
			           	    	$.dialog.alert(msg.infor);  		    	
			           	    }
			           	});
		             }
				 },{
				 	name: 'No',
					focus: true
				 }]
			}).zindex();
		}
	}
	//编辑
	function edittype(data){
		var url = basic_WUrl+"/operate/edit/"+data.id+".do?type=${type}";
		ShowIframeDialog("operate",basic_Title,url,show_Width,show_Hight);
	}
</script>
</head>
 <body style="padding:10px" onload="createSearch()">  
       <div id="layout1">
          <div class="panelBar">
	            <ul class="toolBar">
				   <li><a class="delete" onclick="backSale()"><span>驳回</span></a></li>
               </ul>
          </div>
          <div id="pageHeader" class="pageHeader">
               <div class="searchBar" id="multipleSearchDialog">
	                <table class="table" width="100%" id="searchHeader" >  
                        <tbody id="newbody">
                        </tbody>
 	                </table>
                    <div class="subBar">
			             <ul>
				             <li><div class="buttonActive"><div class="buttonContent"><button type="submit" id="btnSearch" onclick="searchAP()">查询</button></div></div></li>
				             <li><a class="button" onclick="clearSearch()"><span>重置</span></a></li>
			             </ul>
	                </div>
               </div>
          </div>
      </div>
      <div position="center" id="table1">
      </div>
      <div class="clear"></div>
<!--    </div> -->
    </body>
</html>